﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


using TimKen.DataEntity;
using TimKen.BussLogic;
using TimKen.App;
using System.Data;
using System.Text;

namespace TimKen.Web.Orders
{
    public partial class OrderPrint : WebPage
    {
        public DataEntity.Order Order = new TimKen.DataEntity.Order();
        private OrderManager OrderManager = new OrderManager();
        public DataRowCollection drs;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (CurrentUserName == null || CurrentUserName == "")
                {
                    Alert("您必须登录！", "../Index.aspx");
                }
                if (Request.QueryString["OrderID"] != null)
                {
                    OrderID = Request.QueryString["OrderID"];

                    Order = OrderManager.GetModel(OrderID);
                    Order.ContractStatus = 0;
                    OrderManager.Update(Order);

                }

                BindData();
            }

        }

        public string OrderID
        {
            get
            {
                if (ViewState["OrderID"] != null)
                    return ViewState["OrderID"].ToString();
                else
                    return "";
            }
            set
            {
                ViewState["OrderID"] = value;
            }
        }

        private void BindData()
        {
            Order = OrderManager.GetModel(OrderID);
            TimKen.BussLogic.OrderItemManager orderItemM = new TimKen.BussLogic.OrderItemManager();
            DataSet orderItems = orderItemM.GetOrderItems(OrderID);
            drs = orderItems.Tables[0].Rows;
        }

    }
}
